{% extends "base.html" %}

{% block content %}
<table>
	<tr valign="top">
		<td><img src="{{user.avatar(128)}}"></td>
		<td>
            <h1>User: {{user.nickname}}</h1>
            {% if user.about_me %}<p>{{ user.about_me }}</p>{% endif %}
            {% if user.last_seen %}
            <p><em>{{ momentjs(user.last_seen).calendar() }}</em></p>
            {% endif %}
            <p>{{user.followers.count()}} followers |
            {% if user.id == g.user.id %}
                <a href="{{url_for('edit')}}">Edit your profile</a>
            {% elif not g.user.is_following(user) %}
                <a href="{{url_for('follow', nickname = user.nickname)}}">Follow</a>
            {% else %}
                <a href="{{url_for('unfollow', nickname = user.nickname)}}">Unfollow</a>
            {% endif %}
        </p>
		</td>
	</tr>
</table>
<hr>
{% for post in posts.items %}
{% include 'post.html' %}
{% endfor %}
{% if posts.has_prev %}
<a href="{{url_for('user', nickname=user.nickname, page=posts.prev_num)}}"><< Newer posts</a>
{% else %}
<< Newer posts
{% endif %} |
{% if posts.has_next %}
<a href="{{url_for('user', nickname=user.nickname, page=posts.next_num)}}">Older posts >></a>
{% else %}
Older posts >>
{% endif %}
{% endblock %}	